<script language="javascript" type="text/javascript">
/*
   * 引用了全局变量 ds_attr_type_list_{view_id} 在文件: dmt_showview.html 中定义
   * 引用了全局函数 dsbAfterAttrOpr_{view_id} 在文件: dmt_showivew_battr.html 中定义
   */
var dsba_attrinfo_<?cs var:config.view_id ?> = $.parseJSON('<?cs var:config.attr_list ?>');

function dsbaSetAttrList_<?cs var:config.view_id ?>(attrinfo)
{
	var list = "";
	var listattr = attrinfo.list;
	for(var i=0,j=0; i < attrinfo.count && i < listattr.length; i++)
	{
		list += "<tr>";
		j = (<?cs var:config.currentPage ?>-1) * <?cs var:config.numPerPage ?> + 1;
		list += "<td><input name='bind_attr_<?cs var:config.view_id ?>' value='" ;
		list += listattr[i].id + "' type='checkbox'></td>";
		list += "<td>" + listattr[i].id + "</td>";
		list += "<td>" + listattr[i].name + "</td>";
		list += "<td>" + ds_attr_type_list_<?cs var:config.view_id ?>[listattr[i].attr_type] + "</td>";

		if(listattr[i].data_type == <?cs var:config.sum_report_m ?>)
			list += "<td>累计量</td>";
		else if(listattr[i].data_type == <?cs var:config.sum_report_his ?>)
			list += "<td>历史累计量</td>";
		else if(listattr[i].data_type == <?cs var:config.sum_report_min ?>)
			list += "<td>取上报最小值</td>";
		else if(listattr[i].data_type == <?cs var:config.sum_report_max ?>)
			list += "<td>取上报最大值</td>";
		else if(listattr[i].data_type == <?cs var:config.str_report_d ?>)
			list += "<td>字符串型</td>";
		else if(listattr[i].data_type == <?cs var:config.str_report_d_ip ?>)
			list += "<td>字符串型-IP省级</td>";
		else if(listattr[i].data_type == <?cs var:config.data_percent ?>)
			list += "<td>百分比数值(0-100)</td>";
		else if(listattr[i].data_type == <?cs var:config.ex_report ?>)
			list += "<td>异常量</td>";
		else
			list += "<td>数据类型未知</td>";

		list += "</tr>";
	}
	return list;
}

function dsba_SetCurrent_<?cs var:config.view_id ?>()
{
    return 'ds_dlg_bind_attr_<?cs var:config.view_id ?>';
}

function dsbaClearSearch_<?cs var:config.view_id ?>()
{
	$("#dsba_attr_data_type_<?cs var:config.view_id ?>").val(0);
	$("input[name=dam_attr_id]").val('');
	$("input[name=dam_attr_type]").val(0);
	$("input[name=dam_attr_type_name]").val("");
	return false;
}

$(document).ready(function(){
	var attr_info = dsbaSetAttrList_<?cs var:config.view_id ?>(dsba_attrinfo_<?cs var:config.view_id ?>);
	var attr = $("#dsba_attr_list_info_<?cs var:config.view_id ?>");
	attr.html(attr_info);

	$("select[name=dsba_attr_data_type] option").each(function(){
		<?cs if:config.dsba_attr_data_type ?>
			if(this.value == <?cs var:config.dsba_attr_data_type ?>)
				$(this).attr("selected", true);
		<?cs /if ?>
	});

	$("select[name=numPerPage] option").each(function(){
		if(this.value == <?cs var:config.numPerPage ?>)
			$(this).attr("selected", true);
	});
});

</script>

<div class="pageHeader">
	<form class="pagerForm" method="post" action="<?cs var:config.cgipath?>mt_slog_showview?action=bind_attr_search&view_id=<?cs var:config.view_id ?>">
		<?cs include:config.cspath+"dmt_page_para.html" ?>
		<input type="hidden" name="dsba_attr_data_type" value="<?cs var:config.dsba_attr_data_type ?>" />
		<input type="hidden" name="dam_attr_type" value="<?cs var:config.dam_attr_type ?>">
		<input type="hidden" name="dam_attr_type_name" value="<?cs var:config.dam_attr_type_name ?>">
	</form>

	<form onsubmit="return divSearch(this, 'dsb_bind_attr_list_<?cs var:config.view_id ?>');" action="<?cs var:config.cgipath?>mt_slog_showview?action=bind_attr_search&view_id=<?cs var:config.view_id ?>" method="post">
		<div class="searchBar">
			<ul class="searchContent" >
				<li class="width:auto">
					<label style='width:46px'>数据类型：</label>
					<select class='xrk_combox' name="dsba_attr_data_type" id="dsba_attr_data_type_<?cs var:config.view_id ?>">
						<option value="0">全部</option>
						<option value="<?cs var:config.sum_report_m ?>">累计量</option>
						<option value="<?cs var:config.sum_report_his ?>">历史累计量</option>
						<option value="<?cs var:config.sum_report_min ?>">取上报最小值</option>
						<option value="<?cs var:config.sum_report_max ?>">取上报最大值</option>
						<option value="<?cs var:config.ex_report ?>">异常量</option>
						<option value="<?cs var:config.str_report_d ?>">字符串型</option>
						<option value="<?cs var:config.str_report_d_ip ?>">字符串型-IP省级</option>
						<option value="<?cs var:config.data_percent ?>">百分比数值(0-100)</option>
					</select>
				</li>

				<li class="width:auto">
					 <label style='width:50px'>监控点ID：</label>
					 <input type="text" size='6' name="dam_attr_id" value="<?cs var:config.dam_attr_id ?>">
				</li>

				<li class="width:auto">
					<label style='width:60px'>监控点类型：</label>
					<input type="hidden" name="dam_attr_type" value="<?cs var:config.dam_attr_type ?>">
					<input type="text" size="12" name="dam_attr_type_name" value="<?cs var:config.dam_attr_type_name ?>" readonly="readonly" />
				</li>
				<li class="width:auto">
					<a class="btnLook" href="<?cs var:config.cgipath ?>mt_slog_attr?action=lookUpAttrType" title="监控点类型选择" lookupGroup="" fk_callback='dsba_SetCurrent_<?cs var:config.view_id ?>' ></a>
				</li>
			</ul>
			
			<div class='subBar'>
				<ul>
					<li>
						<button type="submit" class="buttonActive"><i class='icon-search icon-large '></i>查找</button>
					</li>
					<li>
						<button title='重置查询条件' class="buttonActive" id="dsba_btn_erase_<?cs var:config.view_id ?>" onclick="return dsbaClearSearch_<?cs var:config.view_id ?>()"><i class='icon-trash icon-large'></i></button>
					</li>
				</ul>
			</div>
		</div>
	</form>

	<div class="panelBar">
		<ul class="toolBar">
			<li><a class="edit" targetType="dialog" postType="string" callback="dsbAfterAttrOpr_<?cs var:config.view_id ?>" target="selectedTodo" rel="bind_attr_<?cs var:config.view_id ?>" href="<?cs var:config.cgipath ?>mt_slog_showview?action=save_not_bind_attr&view_id=<?cs var:config.view_id ?>"><i class='icon-unlock icon-large'></i>解绑</a></li>
			<li class="line">line</li>
		</ul>
	</div>

</div>
	
<div class="pageContent">
	<table class="list" width="100%" layoutH='0'>
		<thead>
			<tr>
				<th width="22"><input type="checkbox" group="bind_attr_<?cs var:config.view_id ?>" class="checkboxCtrl"></th>
				<th width="40">监控点id</th>
				<th width="140">监控点名称</th>
				<th width="140">监控点类型</th>
				<th width="120">数据类型</th>
			</tr>
		</thead>
		<tbody id="dsba_attr_list_info_<?cs var:config.view_id ?>">
		</tbody>
	</table>

	<div class="panelBar">
		<div class="pages">
			<span>每页显示</span>
			<select class="combox" name="numPerPage" onchange="dialogPageBreak({numPerPage:this.value}, 'dsb_bind_attr_list_<?cs var:config.view_id ?>')">
				<option value="10">10</option>
				<option value="20">20</option>
				<option value="50">50</option>
				<option value="100">100</option>
				<option value="200">200</option>
			</select>
			<span>条，共 <?cs var:config.totalCount ?>  条</span>
		</div>
		<div class="pagination" rel="dsb_bind_attr_list_<?cs var:config.view_id ?>" targetType="dialog" totalCount="<?cs var:config.totalCount ?>" numPerPage="<?cs var:config.numPerPage ?>" pageNumShown="<?cs var:config.pageNumShown ?>" currentPage="<?cs var:config.currentPage ?>"></div>

	</div>
</div> <!-- pageContent -->

